﻿using Spire.Pdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DeluxeSources.Practices.Handlers
{
    public partial class ExportHandler : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PdfDocument documentInstance = new PdfDocument();
            documentInstance.LoadFromHTML(HttpUtility.UrlDecode(this.Request.QueryString["targetDataSourceUri"]), false, false, true);
            this.Response.ContentType = "application/pdf";
            this.Response.AddHeader("Content-Disposition", "attachment;filename=Spire PDF for ASPNET.pdf");
            documentInstance.SaveToStream(this.Response.OutputStream, FileFormat.PDF);
        }
    }
}